<?php
//header("Content-type: text/html; charset=utf8");
include 'wexin_connect.php';//调用connect.php文件
$something=$_GET['something'];//'小明';//接收小程序传过来的参数'1';//
if ($con->connect_error) {
	die("连接失败：".$con->connect_error);
}
else 
{
 	$sql="SELECT * FROM `food` WHERE `name` = '$something' ";//根据传入的参数查询数据库中的数据
 	$res=$con->query($sql);
 	echo $con->error;
 	print_r($res->fetch_all (MYSQLI_BOTH));
 	if ($res){
 		$data=$res->fetch_all(PDO::FETCH_LAZY);
 	}
 	else{
    	echo '查询出错！';
    }
  //fetch_all查询所有行
  
 	echo json_encode($data);//返回二维数组形式的值供小程序端用
}
?>